<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
 Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
	
		parent.document.title="MarkLogicWordAddin.js Overview";
	
}
</script>
</head>
<body bgcolor="white" onload="asd();">

<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> 	<font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b></b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<center>
	
	   <h2>MarkLogicWordAddin.js</h2>
	
</center>

	


<h4>Summary</h4>
<p>
	
		API documentation for MarkLogicWordAddin.js



 http://www.marklogic.com 

 <BR/><BR/><B>Version: </B>0.1<BR/><BR/><B>Author:</B> Pete Aven pete.aven@marklogic.com
 <BR/>
	
</p>

<hr>


    <table border="1" cellpadding="3" cellspacing="0" width="100%">
    <tr bgcolor="#CCCCFF" class="TableHeadingColor">
    <td colspan=2><font size="+2">
    
        <b>Class Summary</b>
    
    </font></td>
    </tr>
    
    <tr bgcolor="white" class="TableRowColor">
    <td width="15%"><b><a href="MLA.html">MLA</a></b></td>
    <td>&nbsp;</td>
    </tr>
    
    </table>
    <hr/> 


<!-- ========== METHOD SUMMARY =========== -->

<!-- ========== END METHOD SUMMARY =========== -->


        <pre class="sourceview"><span class="comment">//Copyright 2002-2008 Mark Logic Corporation.  All Rights Reserved.</span>
<span class="comment">/** 
 * <span class="attrib">@fileoverview</span>  API documentation for MarkLogicWordAddin.js
 *
 *
 *
 * {<span class="attrib">@link</span> http://www.marklogic.com} 
 *
 * <span class="attrib">@author</span> Pete Aven pete.aven<span class="attrib">@marklogic</span>.com
 * <span class="attrib">@version</span> 0.1 
 */</span>
<span class="comment">//Copyright 2002-2008 Mark Logic Corporation.  All Rights Reserved.</span>
<span class="comment">//var MLA = {};</span>


<span class="comment">/**
 * The MLA namespace is used for global attribution. The methods within this namespace provide ways of interacting with an active Open XML document through a WebBrowser control. The control must be deployed within an Addin in Office 2007.
 *
 * The functions here provide ways for interacting with the ActiveDocument in Word; however, the functions getCustomXMLPart(), getCustomXMLPartIds(), addCustomXMLPart(), and deleteCustomXMLPart() will work for any Open XML package, provided they are used within the context of an Addin for the appropriate Office application.
 */</span>
<span class="comment">/* var MLA = {}; */</span>

<span class="reserved">function</span> MLA(){
      <span class="reserved">this</span>.getClassName = <span class="reserved">function</span>(){
      <span class="reserved">return</span> <span class="literal">"MLA"</span>;
   
      }
}

<span class="comment">/** <span class="attrib">@ignore</span> */</span>
MLA.version = { <span class="literal">"release"</span> : <span class="literal">"@MAJOR_VERSION.@MINOR_VERSION@PATCH_VERSION"</span> }; 

<span class="comment">/** <span class="attrib">@ignore</span> */</span>
MLA.SimpleRange = <span class="reserved">function</span>(begin,finish){
	<span class="reserved">this</span>.start = begin;
	<span class="reserved">this</span>.end = finish;

};

<span class="comment">/** <span class="attrib">@ignore</span> */</span>
String.<span class="reserved">prototype</span>.trim = <span class="reserved">function</span>() {
	<span class="reserved">return</span> <span class="reserved">this</span>.replace(/^\s+|\s+$/g,<span class="literal">""</span>);
}


<span class="comment">/**
 * Returns version of MarkLogicWordAddin.js library
 * <span class="attrib">@return</span> the version of MarkLogicWordAddin.js
 * <span class="attrib">@type</span> String
 */</span>
MLA.getVersion = <span class="reserved">function</span>()
{
	<span class="reserved">return</span> MLA.version.release;
}

<span class="comment">/** <span class="attrib">@ignore</span> */</span>
MLA.errorCheck = <span class="reserved">function</span>(message)
{
	var returnVal = null;
        var errStr = message.substring(0,6);
	var len = message.length;
        var errMsg = message.substring(7,len);

        <span class="reserved">if</span>(errStr==<span class="literal">"error:"</span>)
		returnVal=errMsg;

	<span class="reserved">return</span> returnVal;

}
<span class="comment">/** Utility function for creating Microsoft.XMLDOM object from string
 *
 *<span class="attrib">@param</span> xmlString the string to be loaded into a XMLDOM object.  The string must be serialized, well-formed XML.
 *<span class="attrib">@return</span> Microsoft.XMLDOM object
 *<span class="attrib">@throws</span> Exception if unable to create the XMLDOM object
 */</span>
MLA.createXMLDOM = <span class="reserved">function</span>(xmlstring)
{
	try{
		var xmlDom = new ActiveXObject(<span class="literal">"Microsoft.XMLDOM"</span>);
       		xmlDom.async=false;
       		xmlDom.loadXML(xmlstring);
	}
	catch(err)
 	{
                throw(<span class="literal">"Error: Not able to create XMLDOM from string "</span>);
	}

        <span class="reserved">if</span>(xmlDom.text==<span class="literal">""</span> &amp;&amp; xmlDom.xml == <span class="literal">""</span>)
                throw(<span class="literal">"Error: Not able to create XMLDOM from string "</span>);

   <span class="reserved">return</span> xmlDom;
}

<span class="comment">/** <span class="attrib">@ignore</span> */</span>
MLA.unescapeXMLCharEntities = <span class="reserved">function</span>(stringtoconvert)
{
	var unescaped = <span class="literal">""</span>;
	unescaped = stringtoconvert.replace(/&amp;amp;/g,<span class="literal">"&amp;"</span>);
	unescaped = unescaped.replace(/&amp;lt;/g,  <span class="literal">"&lt;"</span>);
	unescaped = unescaped.replace(/&amp;gt;/g,  <span class="literal">"&gt;"</span>);
	unescaped = unescaped.replace(/&amp;quot;/g,<span class="literal">"\"</span><span class="literal">");
	unescaped = unescaped.replace(/&amp;apos;/g,"</span>\<span class="literal">'");
	return unescaped;
}
/** @ignore */
MLA.escapeXMLCharEntities = function(stringtoconvert)
{
	var escaped = "";
	escaped = stringtoconvert.replace(/&amp;/g,"&amp;amp;");
	escaped = escaped.replace(/&lt;/g, "&amp;lt;");
	escaped = escaped.replace(/&gt;/g, "&amp;gt;");
	escaped = escaped.replace(/\"/g,"&amp;quot;");
	escaped = escaped.replace(/\'</span>/g, <span class="literal">"&amp;apos;"</span>);
	<span class="reserved">return</span> escaped;
}
<span class="comment">/** Utility function to create a default WordprocessingML paragraph &lt;w:p&gt;, with no styles, for a given string.
 *
 *<span class="attrib">@param</span> textstring the string to be converted into a WordprocessingML paragraph
 *<span class="attrib">@return</span> Microsoft.XMLDOM object that is a WordprocessingML paragraph
 *<span class="attrib">@throws</span> Exception if unable to create the paragraph
 */</span>
MLA.createParagraph = <span class="reserved">function</span>(textstring)
{ 
	var cleanstring = MLA.escapeXMLCharEntities(textstring);
	var newParagraphString = <span class="literal">"&lt;w:p xmlns:w='http://schemas.openxmlformats.org/wordprocessingml/2006/main'&gt;&lt;w:r&gt;&lt;w:t&gt;"</span>+
		                    cleanstring+
			         <span class="literal">"&lt;/w:t&gt;&lt;/w:r&gt;&lt;/w:p&gt;"</span>;
	var newPara = MLA.createXMLDOM(newParagraphString);
	<span class="reserved">return</span> newPara;
}
<span class="comment">/** Inserts text into the ActiveDocument at current cursor position.  Text will be styled according to whatever is the currently chosen style for text within Word. 
 *<span class="attrib">@param</span> textToInsert the text to be inserted at the current cursor position in the ActiveDocument.
 *<span class="attrib">@throws</span> Exception if unable to insert text 
 */</span>
MLA.insertText = <span class="reserved">function</span>(textToInsert)
{
	var textAdded = window.external.insertText(textToInsert);
	var errMsg = MLA.errorCheck(textAdded);
	<span class="reserved">if</span>(errMsg!=null)
	   throw(<span class="literal">"Error: Not able to insert text "</span>+errMsg);
     
	<span class="reserved">if</span>(textAdded==<span class="literal">""</span>)
	  textAdded = null;
}
<span class="comment">/**
 *  Returns the text currently selected (highlighted) by the user in the ActiveDocument.  Whatever is highlighted by the user will be returned in this function as a string.  A user may highlight text from multiple paragraphs or from tables.  For this reason, the function returns an array, where each element of the array is a string that contains the text contained by the structure highlighted by the user in the ActiveDocument.  The order of elements in the array represents the order of items that are highlighted in the ActiveDocument.
 *<span class="attrib">@return</span> the text selected by the user in the ActiveDocument as strings. If nothing is selected, an empty array is returned.
 *<span class="attrib">@type</span> Array
 *<span class="attrib">@param</span> delimiter (optional) Text from tables will be returned as a single string, with cells delimited by tabs (default).  This param may be used to assign a different delimiter.  Note: there is no delimiter for text from paragraphs, as each paragraph will be captured in separate array elements.
 *<span class="attrib">@throws</span> Exception if unable to retrieve the Selection
 */</span>
MLA.getSelectionText = <span class="reserved">function</span>(delimiter)
{
        <span class="reserved">if</span>(delimiter == null) 
	    delimiter = <span class="literal">""</span>;

	var arrCount=0;
	var selCount =0;
	var selections = new Array();
        
	var selection =  window.external.getSelectionText(selCount,delimiter);

	var err = false;
	var errMsg = MLA.errorCheck(selection);
	<span class="reserved">if</span>(errMsg!=null)
	{
		err=true;
		selection=<span class="literal">""</span>;
	}


	selections[arrCount]=selection;

	<span class="reserved">while</span>(selection!=<span class="literal">""</span>)
	{
  	  selCount++;
          arrCount++;
	  selection = window.external.getSelectionText(selCount,delimiter);


	  var errMsg = MLA.errorCheck(selection);
	  <span class="reserved">if</span>(errMsg!=null){
   	    err=true;
	    selection=<span class="literal">""</span>;
	  }

	  <span class="reserved">if</span>(selection!=<span class="literal">""</span>)
	      selections[arrCount] = selection;

	}

	<span class="reserved">if</span>(err==true)
	{
	   throw(<span class="literal">"Error: Not able to getSelection; "</span>+errMsg);
	}



	<span class="reserved">if</span>(selections.length == 1) 
	{
        	<span class="reserved">if</span> (selections[0] == null ||selections[0].text == <span class="literal">""</span>)
		{
			selections.length = 0;
		}
	}

	<span class="reserved">return</span> selections;
}
<span class="comment">/**
 * Returns ids for custom parts (not built-in) that are part of the active Open XML package. (.docx, .xlsx, .pptx, etc.)
 * <span class="attrib">@returns</span> the ids for custom XML parts in active Open XML package as array of string
 * <span class="attrib">@type</span> Array 
 */</span>
MLA.getCustomXMLPartIds = <span class="reserved">function</span>()
{ 
	var partIds = window.external.getCustomXMLPartIds();

	var errMsg = MLA.errorCheck(partIds);

	<span class="reserved">if</span>(errMsg!=null)
	  throw(<span class="literal">"Error: Not able to get CustomXMLPartIds; "</span>+errMsg);

	var customPartIds = partIds.split(<span class="literal">" "</span>);

	<span class="reserved">if</span>(customPartIds.length ==1)
	{
		<span class="reserved">if</span> (customPartIds[0] == null || customPartIds[0] == <span class="literal">""</span>)
		{
			customPartIds.length = 0;
		}
	}

	<span class="reserved">return</span> customPartIds;
}

<span class="comment">/**
 * Returns the custom XML part, identified by customXMLPartId, that is part of the active Open XML package. (.docx, .xlsx, .pptx, etc.)
 * <span class="attrib">@param</span> customXMLPartId the id of the custom part to be fetched from the active package
 * <span class="attrib">@return</span> the XML for the custom part as a DOM object. 
 * <span class="attrib">@type</span> Microsoft.XMLDOM object 
 * <span class="attrib">@throws</span> Exception if there is error retrieving the custom part 
 */</span>
MLA.getCustomXMLPart = <span class="reserved">function</span>(customXMLPartId)
{
	var customXMLPart = window.external.getCustomXMLPart(customXMLPartId);

	var errMsg = MLA.errorCheck(customXMLPart);

	<span class="reserved">if</span>(errMsg!=null){
	   throw(<span class="literal">"Error: Not able to getCustomXMLPart; "</span>+errMsg);
	}
        
	var v_cp;

	<span class="reserved">if</span>(customXMLPart==<span class="literal">""</span>)
	{
		v_cp=null;
	}
        <span class="reserved">else</span>
	{
        	v_cp = MLA.createXMLDOM(customXMLPart); 
	}

	<span class="reserved">return</span> v_cp;
}

<span class="comment">/** Adds custom part to active Open XML package.  Returns the id of the part added.
 *<span class="attrib">@param</span> customPartXML Either A) an XMLDOM object that is the custom part to be added to the active Open XML package, or B)The string serialization of the XML to be added as a custom part to the active Open XML package. ( The XML must be well-formed. )
 *<span class="attrib">@return</span> id for custom part added 
 *<span class="attrib">@type</span> String
 *<span class="attrib">@throws</span> Exception if unable to add custom part
 */</span>
MLA.addCustomXMLPart = <span class="reserved">function</span>(customPartXml)
{
	var v_customPart =<span class="literal">""</span>;
	<span class="reserved">if</span>(customPartXml.xml)
	{
               v_customPart=customPartXml.xml;
	}
	<span class="reserved">else</span>
	{
	       v_customPart=customPartXml
	}
	
	var newId = window.external.addCustomXMLPart(v_customPart);

	var errMsg = MLA.errorCheck(newId);
	<span class="reserved">if</span>(errMsg!=null)
	   throw(<span class="literal">"Error: Not able to addCustomXMLPart; "</span>+errMsg);

	<span class="reserved">if</span>(newId ==<span class="literal">""</span>)
	  newId=null;

	<span class="reserved">return</span> newId;
}

<span class="comment">/** Deletes custom part from Active Open XML package identified by id.
 *<span class="attrib">@param</span> customXMLPartId the id of the custom part to be deleted from the active Open XML package.
 *<span class="attrib">@throws</span> Exception if unable to delete custom part
 */</span>
MLA.deleteCustomXMLPart = <span class="reserved">function</span>(customXMLPartId)
{
	var deletedPart = window.external.deleteCustomXMLPart(customXMLPartId);

        var errMsg = MLA.errorCheck(deletedPart);
	<span class="reserved">if</span>(errMsg!=null)
	   throw(<span class="literal">"Error: Not able to deleteCustomXMLPart; "</span>+errMsg);
     
	<span class="reserved">if</span>(deletedPart==<span class="literal">""</span>)
	  deletedPart = null;

}

<span class="comment">/** Returns the XML that represents what is currently selected (highlighted) by the user in the ActiveDocument as an XMLDOM object.  Whatever is highlighted by the user will be returned in this function as a block level element.  A user may highlight text that will be materialized as multiple sibling block elements in the XML.  For this reason, the function returns an array, where each element of the array is an XMLDOM object that contains the XML for the blocks highlighted by the user in the ActiveDocument.  The order of elements in the array represents the order of items that are highlighted in the ActiveDocument.
 *<span class="attrib">@return</span> the blocks of XML currently selected by the user in the ActiveDocument as XMLDOM objects. If nothing is selected, an empty array is returned.
 *<span class="attrib">@type</span> Array
 *<span class="attrib">@throws</span> Exception if unable to retrieve the Selection
*/</span>
MLA.getSelection = <span class="reserved">function</span>()
{
	var arrCount=0;
	var selCount =0;
	var selections = new Array();
	var domSelections = new Array();
        
	var selection =  window.external.getSelection(selCount);

	var err = false;
	var errMsg = MLA.errorCheck(selection);
	<span class="reserved">if</span>(errMsg!=null)
	{
		err=true;
		selection=<span class="literal">""</span>;
	}


	selections[arrCount]=selection;

	<span class="reserved">while</span>(selection!=<span class="literal">""</span>)
	{
  	  selCount++;
          arrCount++;
	  selection = window.external.getSelection(selCount);


	  var errMsg = MLA.errorCheck(selection);
	  <span class="reserved">if</span>(errMsg!=null){
   	    err=true;
	    selection=<span class="literal">""</span>;
	  }

	  <span class="reserved">if</span>(selection!=<span class="literal">""</span>)
	      selections[arrCount] = selection;

	}

	<span class="reserved">if</span>(err==true)
	{
	   throw(<span class="literal">"Error: Not able to getSelection; "</span>+errMsg);
	}



	<span class="reserved">for</span>(i=0;i&lt;selections.length;i++)
	{
         	domSelections[i] = MLA.createXMLDOM(selections[i]);
	}
	
	<span class="reserved">if</span>(domSelections.length == 1) 
	{
        	<span class="reserved">if</span> (domSelections[0] == null ||domSelections[0].text == <span class="literal">""</span>)
		{
			domSelections.length = 0;
		}
	}

	<span class="reserved">return</span> domSelections;
}

<span class="comment">/** Returns the final XML block that represents the Sentence at the current cursor position.  Nothing is required to be highlighted in the ActiveDocument.  If a selection is highlighted, this returns the XML for the sentence at the the current cursor position.  If there is no selection, the XML for the sentence at the current cursor position is still returned. 
 *<span class="attrib">@return</span> the block of XML, as XMLDOM object,  for the Sentence immediately preceding the cursor position.
 *<span class="attrib">@type</span> Microsoft.XMLDOM object
 *<span class="attrib">@throws</span> Exception if unable to retrieve the XML for the Sentence.
*/</span>
MLA.getSentenceAtCursor = <span class="reserved">function</span>()
{
	var rangeXml = window.external.getSentenceAtCursor();

	var errMsg = MLA.errorCheck(rangeXml);
	<span class="reserved">if</span>(errMsg!=null) 
	   throw(<span class="literal">"Error: Not able to get Sentence at Cursor; "</span>+errMsg);

	var v_rangeXml = MLA.createXMLDOM(rangeXml);
	<span class="reserved">return</span> v_rangeXml;
}

<span class="comment">/** Returns the document.xml for the ActiveDocument as XMLDOM object. 
 * <span class="attrib">@return</span> document.xml from the active Open XML package -- NOTE: This is the materialized view of the document.  If you have Content Controls bound to XML data islands within the .docx package, you'll only see the inline text, not the references, nor the original XML from which the value was mapped.
 * <span class="attrib">@type</span> Microsoft.XMLDOM object
 * <span class="attrib">@throws</span> Exception if unable to retrieve Styles.xml from the ActiveDocument.
 */</span>
MLA.getActiveDocXml = <span class="reserved">function</span>()
{
	var documentXml = window.external.getActiveDocXml();

        var errMsg = MLA.errorCheck(documentXml);
	<span class="reserved">if</span>(errMsg!=null)
	   throw(<span class="literal">"Error: Not able to getActiveDocumentXml; "</span>+errMsg);

	<span class="reserved">if</span>(documentXml==<span class="literal">""</span>)
          documentXml=null;

	var v_documentXml = MLA.createXMLDOM(documentXml);
	<span class="reserved">return</span> v_documentXml;

}

<span class="comment">/** Returns the Styles.xml for the ActiveDocument as XMLDOM object. 
 * <span class="attrib">@return</span> Styles.xml if no Styles.xml present in ActiveDocument package, returns null.
 * <span class="attrib">@type</span> Microsoft.XMLDOM object
 *<span class="attrib">@throws</span> Exception if unable to retrieve Styles.xml from the ActiveDocument.
 */</span>
MLA.getActiveDocStylesXml = <span class="reserved">function</span>()
{ 
	var stylesXml = window.external.getActiveDocStylesXml();

        var errMsg = MLA.errorCheck(stylesXml);
	<span class="reserved">if</span>(errMsg!=null)
	   throw(<span class="literal">"Error: Not able to getActiveDocStylesXml; "</span>+errMsg);

	<span class="reserved">if</span>(stylesXml==<span class="literal">""</span>)
          stylesXml=null;

	var v_stylesXml = MLA.createXMLDOM(stylesXml);
	<span class="reserved">return</span> v_stylesXml;
}

<span class="comment">/** Inserts document.xml into the ActiveDocument package in Word.  This will replace the contents of the entire document the user is currently viewing. 
 *
 * As this only allows insert of document.xml, it is assumed that whatever references required by document.xml by other xml files in the package currently being authored (styles, themes, etc.) already exist.
 * 
 *<span class="attrib">@param</span> documentXml this parameter may either be A) an XMLDOM object that is the XML equivalent of the document.xml to be inserted,or B) a String, that is the serialized, well-formed XML of the document.xml to be inserted.
 *<span class="attrib">@throws</span> Exception if unable to set the documentXml
 */</span>
MLA.setActiveDocXml = <span class="reserved">function</span>(documentXml)
{
	var v_document=<span class="literal">""</span>;

	<span class="reserved">if</span>(documentXml.xml)
	{ 
               v_document=documentXml.xml;
	}
	<span class="reserved">else</span>
	{ 
	       v_document = documentXml;
	}

        var inserted = window.external.setActiveDocXml(v_document);

	var errMsg = MLA.errorCheck(inserted);
	<span class="reserved">if</span>(errMsg!=null)
	   throw(<span class="literal">"Error: Not able to setActiveDocXml; "</span>+errMsg);

	<span class="reserved">if</span>(inserted==<span class="literal">""</span>)
	  inserted = null;
}

<span class="comment">/** <span class="attrib">@ignore</span> */</span>
MLA.isArray = <span class="reserved">function</span>(obj)
{
 <span class="reserved">return</span> obj.constructor == Array;
}

<span class="comment">/** Inserts block-level xml into the ActiveDocument in Word at the current cursor position, or over the selected range (if selected).  If stylesxml parameter is defined, the blockxml will be inserted and the Styles.xml will be overwritten with the stylesxml contents. If stylesxml is not defined, then only the blockxml will be inserted ; the assumption being that whatever styles required by the blockxml are already present in the .docx Styles.xml.
 *
 * There are two main levels of content in the document.xml; block-level and inline content. Block level describes the structure of the document, and includes paragraphs and tables. Anything that can be inserted under &lt;w:body&gt; may be inserted here
 * 
 *<span class="attrib">@param</span> blockXml this parameter may either be A) and XMLDOM object that is the block-level XML to be inserted,or an array of such objects,or B) a String, that is the serialized, well-formed XML of the block to be inserted, or an Array of such Strings.
 *<span class="attrib">@param</span> stylesXml (optional) this parameter is either A) an XMLDOM object that contains Styles.xml for the pacakge, or B)a String, which is the serialized, well-formed XML that represents Styles.xml for the ActiveDocument package in Word.
 *<span class="attrib">@throws</span> Exception if unable to insert the blockContent or Styles.xml
 */</span>
MLA.insertBlockContent = <span class="reserved">function</span>(blockContentXml,stylesXml)
{
	<span class="reserved">if</span>(stylesXml == null) 
	    stylesXml = <span class="literal">""</span>;
  
       
	var v_block=<span class="literal">""</span>;
	var v_styles=<span class="literal">""</span>;

	<span class="reserved">if</span>(blockContentXml.xml)
	{
               v_block=blockContentXml.xml;
	}
	<span class="reserved">else</span>
	{
	  var v_array = MLA.isArray(blockContentXml);

	  <span class="reserved">if</span>(v_array)
	  {
		<span class="reserved">for</span>(var i=0;i&lt;blockContentXml.length;i++)
		{
			v_block = v_block+blockContentXml[i];
		}
	  }
	  <span class="reserved">else</span>
	  {
		v_block = blockContentXml;
	  }
	}

	<span class="reserved">if</span>(stylesXml.xml)
	{
             v_styles=stylesXml.xml;
	}
	<span class="reserved">else</span>
	{
             v_styles=stylesXml;
	}
	
        var inserted = window.external.insertBlockContent(v_block,v_styles);

	var errMsg = MLA.errorCheck(inserted);
	<span class="reserved">if</span>(errMsg!=null)
	   throw(<span class="literal">"Error: Not able to insertBlockContent; "</span>+errMsg);

	<span class="reserved">if</span>(inserted==<span class="literal">""</span>)
	  inserted = null;

}

<span class="comment">/**
 *
 *Returns MLA.config. The fields for this object are version, url, and theme.  
version - the version of the Addin library, url - the url used by the Addin WebBrowser control, theme - the current color scheme used by Office. 
 *<span class="attrib">@throws</span> Exception if unable to create MLA.config object
 */</span>
MLA.getConfiguration = <span class="reserved">function</span>()
{
        var version = window.external.getAddinVersion();
	var color = window.external.getOfficeColor();
	var webUrl = window.external.getBrowserURL();

	<span class="reserved">if</span>(version == <span class="literal">""</span> || color == <span class="literal">""</span> || webUrl == <span class="literal">""</span>)
		throw(<span class="literal">"Error: Not able to access configuration info."</span>);

	MLA.config = {
		        <span class="literal">"version"</span>:version,
			<span class="literal">"url"</span>:webUrl,
			<span class="literal">"theme"</span>:color
	};

        <span class="reserved">return</span> MLA.config;	
}
</pre>
	<hr>



<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b></b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<font size="-1">

</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Sun Dec 14 10:43:40 2008</div>
</body>
</html>
